import { Component } from "@xuekl/cli-core/enums"
import * as c from "@xuekl/cli-core/components"
import { BaseForm } from "@xuekl/cli-core/builder"

export default class Role extends BaseForm {
    roleId = ''
    roleName = ''
    roleKey = ''
    roleSort = 0
    status = '0'
    menuIds: number[] = []
    remark = ''

    clear(): void {
        this.setForm(new Role(this.opts))
        this.resetFields()
    }

    getRoleName(): c.Input {
        return {
            type: Component.Input,
            label: '角色名称',
            mode: ['query'],
            required: true,
            element: {
                maxlength: 20,
            }
        }
    }

    getRoleKey(): c.Input {
        return {
            type: Component.Input,
            label: '权限字符',
            mode: ['query'],
            required: true,
            element: {
                maxlength: 20,
            }
        }
    }

    getRoleSort(): c.InputNumber {
        return {
            type: Component.InputNumber,
            label: '角色顺序',
            required: true,
        }
    }

    getStatus(): c.Radio {
        return {
            type: Component.Radio,
            label: '状态',
            config: {
                dict: 'sys_normal_disable'
            }
        }
    }

    getMenuIds() {
        return {
            label: '菜单权限',
            element: {
            }
        }
    }

    getRemark(): c.Textarea {
        return {
            type: Component.Textarea,
            label: '备注',
        }
    }
}
